Share via


ApplicationPoolContainsApplication Class [IIS 7 and higher]

Provides a relationship between an application pool and its applications.

Syntax

class ApplicationPoolContainsApplication : ObjectContainerAssociation

Methods

This class contains no methods.

Properties

The following table lists the properties for the ApplicationPoolContainsApplication class.

Name

Description

Container

(Inherited from ObjectContainerAssociation.) A read-only ApplicationPool object that represents an IIS application pool. A key property.

Element

(Inherited from ObjectContainerAssociation.) A read-only Application object that represents an IIS application. A key property.

Subclasses

This class contains no subclasses.

Remarks

To implement this association, use the configuration API to enumerate the applications in an application pool.

Example

The following example shows how to use the ApplicationPoolContainsApplication class to retrieve all the applications in an application pool.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the application pool.
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='DefaultAppPool'")

' Use the ApplicationPoolContainsApplication class to return the set of
' application instances in the 'DefaultAppPool' application pool.
Set oApps = oAppPool.Associators_("ApplicationPoolContainsApplication")
For Each oApp In oApps
    WScript.Echo oApp.Path 
Next

Note the following syntax from the preceding code example.

Set oApps = oAppPool.Associators_("ApplicationPoolContainsApplication")

To simplify your code, you can instead use the following syntax, which enables you to use the association without having to remember its exact name.

Set oApps = oAppPool.Associators_(, "Application")

Inheritance Hierarchy

ObjectContainerAssociation

   ApplicationPoolContainsApplication

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

Application Class [IIS 7 and higher]

ApplicationPool Class [IIS 7 and higher]

ObjectContainerAssociation Class [IIS 7 and higher]